#!/usr/bin/env python

"""
docstring
"""

__author__ = 'rx.wen218@gmail.com'

import sys
import os

# add blog-porter root directory to search path
# so that we can find core module
core_path = os.path.abspath(os.path.curdir)
sys.path.append(core_path)

import unittest
from core import post
import datetime

class PostTest(unittest.TestCase):
    def setUp(self):
        pass

    def testCreateDefaultPost(self):
        new_post = post.Post()
        self.assertEqual('', new_post.title)
        self.assertEqual('', new_post.summary)
        self.assertEqual('', new_post.content)
        #self.assertEqual(datetime.datetime.now(), new_post.create_date)
        #self.assertEqual(datetime.datetime.now(), new_post.update_date)
        self.assertEqual(0, len(new_post.tags))
        #self.assertEqual(0, len(new_post.comments))

    def testCreatePostSetTitle(self):
        post_title = 'unit test title'
        new_post = post.Post(title=post_title)
        self.assertEqual(post_title, new_post.title)
        self.assertEqual('', new_post.summary)

    def testCreatePostSetSummary(self):
        post_summary = 'unit test summary'
        new_post = post.Post(summary=post_summary)
        self.assertEqual('', new_post.title)
        self.assertEqual(post_summary, new_post.summary)

    def testCreatePostSetContent(self):
        post_content = 'unit test content'
        new_post = post.Post(content=post_content)
        self.assertEqual(post_content, new_post.content)

    def testCreatePostSetTags(self):
        post_tags = ['tag1', 'tag2']
        new_post = post.Post(tags=post_tags)
        self.assertEqual(post_tags, new_post.tags)

if __name__ == '__main__':
    unittest.main()
